/******************************************************************************
 * SAGE - Scalable Adaptive Graphics Environment
 *
 * Module: sagePointer.h
 * Author : Ratko Jagodic, Byungil Jeong
 *
 *	Description: the super class of simple drawing objects 
 *
 * Copyright (C) 2007 Electronic Visualization Laboratory,
 * University of Illinois at Chicago
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either Version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser Public License along
 * with this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * Direct questions, comments etc about SAGE to bijeong@evl.uic.edu or 
 * http://www.evl.uic.edu/cavern/forum/
 *			
*********************************************************************************/

#ifndef SAGE_POINTER_H
#define SAGE_POINTER_H

#include "sageDrawObject.h"



// custom messages for the pointers
#define RESET 0
#define ABSOLUTE_MOVE 1
#define MOVE_APP     2
#define RESIZE_APP   3
#define MOUSE_DOWN   4
#define MOUSE_UP     5
#define COLOR_CHANGE 6
#define HIDE_POINTER 7
#define SHOW_POINTER 8
#define SHOW_RESIZE_PTR  9  //when the mouse is over a corner


// STATES for drawing pointers
#define NORMAL_STATE 10
#define MOVE_STATE 11
#define RESIZE_STATE 12



class sagePointer : public sageDrawObject {

private:
	void drawOutline();
	void drawCursor(double w, double h);

protected:
	
public:
	// this defines what gets drawn
	// 0=normal, 2=move, 3=resize, 4=down, 5=up
	int state;      // overall pointer
	int prevState;  // for returning to it after mouse_up
	int oldX, oldY;
	int visible; 
	int ptrShape;   // 10=normal, 11=move, 12=resize

	// color of pointer for up/down states
	float up_color[3], down_color[3], *color;

	// for drawing the outline of the app when moving and resizing
	float outline[4];  //left, right, top, bottom
	int cornerId;  //0=none, 1=bottomleft, 2=topleft, 3=topright, 4=bottomright
	float aspectRatio;  //to preserve it during resizing

	
	// METHODS
	sagePointer();
	int init(char *name);	
	int draw();	
	int destroy();
	int parseMessage(char *msg);
};

#endif
